package com.data.model.sqlclause.where.exprssion;

import com.data.model.enums.ExpressionTypeEnum;
import com.data.model.sqlclause.where.basic.Expression;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AndExpression extends Expression {
    /**
     * 表达式
     */
    private List<Expression> expressions;

    @Override
    public String getType() {
        return ExpressionTypeEnum.AND.getCode();
    }

    public static AndExpression of(Expression... expressions) {
        AndExpression andExpression = new AndExpression();
        andExpression.setExpressions(Arrays.asList(expressions));
        return andExpression;
    }

    public static AndExpression of(List<Expression> expressions) {
        AndExpression andExpression = new AndExpression();
        andExpression.setExpressions(expressions);
        return andExpression;
    }
}
